<!--
 * @Author: your name
 * @Date: 2020-06-28 14:23:55
 * @LastEditTime: 2020-07-06 14:22:12
 * @LastEditors: Please set LastEditors
 * @Description: 轮播广告
 * @FilePath: \mobile_project\src\pages\home\components\ad.vue
--> 
<template>
  <div class="ad">
    <van-swipe class="my-swipe" :autoplay="3000" indicator-color="white">
      <van-swipe-item v-for="item of datas" :key="item.id">
        <van-image width="100%" height="100%" lazy-load :src="item.img_path"/>
      </van-swipe-item>
    </van-swipe>
  </div>
</template>

<script>
import * as api from "@/api/apiList/system/system.js";
export default {
  data() {
    return {
      datas: []
    };
  },
  methods: {
    async API_ad() {
      //获取轮播广告
      let params = {
        position: 0
      };
      return await api.ad(params);
    }
  },

  async created() {
    let res = await this.API_ad();
    // console.log(res);
    if (res.data.code === 200) {
      this.datas = res.data.data;
    }
  }
};
</script>

<style lang="scss" scoped>
@import "@/style/home/ad.scss"
</style>